home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / gcc.info-21 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  37.6 KB  |  887 lines

  1. This is Info file gcc.info, produced by Makeinfo version 1.68 from the
  2. input file ./gcc.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * gcc: (gcc).                  The GNU Compiler Collection.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU compiler.
  9.  
  10.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  11. Boston, MA 02111-1307 USA
  12.  
  13.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  14. 1999, 2000 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License" and "Funding
  23. for Free Software" are included exactly as in the original, and
  24. provided that the entire resulting derived work is distributed under
  25. the terms of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that the sections entitled "GNU General Public
  30. License" and "Funding for Free Software", and this permission notice,
  31. may be included in translations approved by the Free Software Foundation
  32. instead of in the original English.
  33.  
  34. 
  35. File: gcc.info,  Node: Insn Lengths,  Next: Constant Attributes,  Prev: Attr Example,  Up: Insn Attributes
  36.  
  37. Computing the Length of an Insn
  38. -------------------------------
  39.  
  40.    For many machines, multiple types of branch instructions are
  41. provided, each for different length branch displacements.  In most
  42. cases, the assembler will choose the correct instruction to use.
  43. However, when the assembler cannot do so, GCC can when a special
  44. attribute, the `length' attribute, is defined.  This attribute must be
  45. defined to have numeric values by specifying a null string in its
  46. `define_attr'.
  47.  
  48.    In the case of the `length' attribute, two additional forms of
  49. arithmetic terms are allowed in test expressions:
  50.  
  51. `(match_dup N)'
  52.      This refers to the address of operand N of the current insn, which
  53.      must be a `label_ref'.
  54.  
  55. `(pc)'
  56.      This refers to the address of the *current* insn.  It might have
  57.      been more consistent with other usage to make this the address of
  58.      the *next* insn but this would be confusing because the length of
  59.      the current insn is to be computed.
  60.  
  61.    For normal insns, the length will be determined by value of the
  62. `length' attribute.  In the case of `addr_vec' and `addr_diff_vec' insn
  63. patterns, the length is computed as the number of vectors multiplied by
  64. the size of each vector.
  65.  
  66.    Lengths are measured in addressable storage units (bytes).
  67.  
  68.    The following macros can be used to refine the length computation:
  69.  
  70. `FIRST_INSN_ADDRESS'
  71.      When the `length' insn attribute is used, this macro specifies the
  72.      value to be assigned to the address of the first insn in a
  73.      function.  If not specified, 0 is used.
  74.  
  75. `ADJUST_INSN_LENGTH (INSN, LENGTH)'
  76.      If defined, modifies the length assigned to instruction INSN as a
  77.      function of the context in which it is used.  LENGTH is an lvalue
  78.      that contains the initially computed length of the insn and should
  79.      be updated with the correct length of the insn.
  80.  
  81.      This macro will normally not be required.  A case in which it is
  82.      required is the ROMP.  On this machine, the size of an `addr_vec'
  83.      insn must be increased by two to compensate for the fact that
  84.      alignment may be required.
  85.  
  86.    The routine that returns `get_attr_length' (the value of the
  87. `length' attribute) can be used by the output routine to determine the
  88. form of the branch instruction to be written, as the example below
  89. illustrates.
  90.  
  91.    As an example of the specification of variable-length branches,
  92. consider the IBM 360.  If we adopt the convention that a register will
  93. be set to the starting address of a function, we can jump to labels
  94. within 4k of the start using a four-byte instruction.  Otherwise, we
  95. need a six-byte sequence to load the address from memory and then
  96. branch to it.
  97.  
  98.    On such a machine, a pattern for a branch instruction might be
  99. specified as follows:
  100.  
  101.      (define_insn "jump"
  102.        [(set (pc)
  103.              (label_ref (match_operand 0 "" "")))]
  104.        ""
  105.        "*
  106.      {
  107.         return (get_attr_length (insn) == 4
  108.                 ? \"b %l0\" : \"l r15,=a(%l0); br r15\");
  109.      }"
  110.        [(set (attr "length") (if_then_else (lt (match_dup 0) (const_int 4096))
  111.                                            (const_int 4)
  112.                                            (const_int 6)))])
  113.  
  114. 
  115. File: gcc.info,  Node: Constant Attributes,  Next: Delay Slots,  Prev: Insn Lengths,  Up: Insn Attributes
  116.  
  117. Constant Attributes
  118. -------------------
  119.  
  120.    A special form of `define_attr', where the expression for the
  121. default value is a `const' expression, indicates an attribute that is
  122. constant for a given run of the compiler.  Constant attributes may be
  123. used to specify which variety of processor is used.  For example,
  124.  
  125.      (define_attr "cpu" "m88100,m88110,m88000"
  126.       (const
  127.        (cond [(symbol_ref "TARGET_88100") (const_string "m88100")
  128.               (symbol_ref "TARGET_88110") (const_string "m88110")]
  129.              (const_string "m88000"))))
  130.      
  131.      (define_attr "memory" "fast,slow"
  132.       (const
  133.        (if_then_else (symbol_ref "TARGET_FAST_MEM")
  134.                      (const_string "fast")
  135.                      (const_string "slow"))))
  136.  
  137.    The routine generated for constant attributes has no parameters as it
  138. does not depend on any particular insn.  RTL expressions used to define
  139. the value of a constant attribute may use the `symbol_ref' form, but
  140. may not use either the `match_operand' form or `eq_attr' forms
  141. involving insn attributes.
  142.  
  143. 
  144. File: gcc.info,  Node: Delay Slots,  Next: Function Units,  Prev: Constant Attributes,  Up: Insn Attributes
  145.  
  146. Delay Slot Scheduling
  147. ---------------------
  148.  
  149.    The insn attribute mechanism can be used to specify the requirements
  150. for delay slots, if any, on a target machine.  An instruction is said to
  151. require a "delay slot" if some instructions that are physically after
  152. the instruction are executed as if they were located before it.
  153. Classic examples are branch and call instructions, which often execute
  154. the following instruction before the branch or call is performed.
  155.  
  156.    On some machines, conditional branch instructions can optionally
  157. "annul" instructions in the delay slot.  This means that the
  158. instruction will not be executed for certain branch outcomes.  Both
  159. instructions that annul if the branch is true and instructions that
  160. annul if the branch is false are supported.
  161.  
  162.    Delay slot scheduling differs from instruction scheduling in that
  163. determining whether an instruction needs a delay slot is dependent only
  164. on the type of instruction being generated, not on data flow between the
  165. instructions.  See the next section for a discussion of data-dependent
  166. instruction scheduling.
  167.  
  168.    The requirement of an insn needing one or more delay slots is
  169. indicated via the `define_delay' expression.  It has the following form:
  170.  
  171.      (define_delay TEST
  172.                    [DELAY-1 ANNUL-TRUE-1 ANNUL-FALSE-1
  173.                     DELAY-2 ANNUL-TRUE-2 ANNUL-FALSE-2
  174.                     ...])
  175.  
  176.    TEST is an attribute test that indicates whether this `define_delay'
  177. applies to a particular insn.  If so, the number of required delay
  178. slots is determined by the length of the vector specified as the second
  179. argument.  An insn placed in delay slot N must satisfy attribute test
  180. DELAY-N.  ANNUL-TRUE-N is an attribute test that specifies which insns
  181. may be annulled if the branch is true.  Similarly, ANNUL-FALSE-N
  182. specifies which insns in the delay slot may be annulled if the branch
  183. is false.  If annulling is not supported for that delay slot, `(nil)'
  184. should be coded.
  185.  
  186.    For example, in the common case where branch and call insns require
  187. a single delay slot, which may contain any insn other than a branch or
  188. call, the following would be placed in the `md' file:
  189.  
  190.      (define_delay (eq_attr "type" "branch,call")
  191.                    [(eq_attr "type" "!branch,call") (nil) (nil)])
  192.  
  193.    Multiple `define_delay' expressions may be specified.  In this case,
  194. each such expression specifies different delay slot requirements and
  195. there must be no insn for which tests in two `define_delay' expressions
  196. are both true.
  197.  
  198.    For example, if we have a machine that requires one delay slot for
  199. branches but two for calls,  no delay slot can contain a branch or call
  200. insn, and any valid insn in the delay slot for the branch can be
  201. annulled if the branch is true, we might represent this as follows:
  202.  
  203.      (define_delay (eq_attr "type" "branch")
  204.         [(eq_attr "type" "!branch,call")
  205.          (eq_attr "type" "!branch,call")
  206.          (nil)])
  207.      
  208.      (define_delay (eq_attr "type" "call")
  209.                    [(eq_attr "type" "!branch,call") (nil) (nil)
  210.                     (eq_attr "type" "!branch,call") (nil) (nil)])
  211.  
  212. 
  213. File: gcc.info,  Node: Function Units,  Prev: Delay Slots,  Up: Insn Attributes
  214.  
  215. Specifying Function Units
  216. -------------------------
  217.  
  218.    On most RISC machines, there are instructions whose results are not
  219. available for a specific number of cycles.  Common cases are
  220. instructions that load data from memory.  On many machines, a pipeline
  221. stall will result if the data is referenced too soon after the load
  222. instruction.
  223.  
  224.    In addition, many newer microprocessors have multiple function
  225. units, usually one for integer and one for floating point, and often
  226. will incur pipeline stalls when a result that is needed is not yet
  227. ready.
  228.  
  229.    The descriptions in this section allow the specification of how much
  230. time must elapse between the execution of an instruction and the time
  231. when its result is used.  It also allows specification of when the
  232. execution of an instruction will delay execution of similar instructions
  233. due to function unit conflicts.
  234.  
  235.    For the purposes of the specifications in this section, a machine is
  236. divided into "function units", each of which execute a specific class
  237. of instructions in first-in-first-out order.  Function units that
  238. accept one instruction each cycle and allow a result to be used in the
  239. succeeding instruction (usually via forwarding) need not be specified.
  240. Classic RISC microprocessors will normally have a single function unit,
  241. which we can call `memory'.  The newer "superscalar" processors will
  242. often have function units for floating point operations, usually at
  243. least a floating point adder and multiplier.
  244.  
  245.    Each usage of a function units by a class of insns is specified with
  246. a `define_function_unit' expression, which looks like this:
  247.  
  248.      (define_function_unit NAME MULTIPLICITY SIMULTANEITY
  249.                            TEST READY-DELAY ISSUE-DELAY
  250.                           [CONFLICT-LIST])
  251.  
  252.    NAME is a string giving the name of the function unit.
  253.  
  254.    MULTIPLICITY is an integer specifying the number of identical units
  255. in the processor.  If more than one unit is specified, they will be
  256. scheduled independently.  Only truly independent units should be
  257. counted; a pipelined unit should be specified as a single unit.  (The
  258. only common example of a machine that has multiple function units for a
  259. single instruction class that are truly independent and not pipelined
  260. are the two multiply and two increment units of the CDC 6600.)
  261.  
  262.    SIMULTANEITY specifies the maximum number of insns that can be
  263. executing in each instance of the function unit simultaneously or zero
  264. if the unit is pipelined and has no limit.
  265.  
  266.    All `define_function_unit' definitions referring to function unit
  267. NAME must have the same name and values for MULTIPLICITY and
  268. SIMULTANEITY.
  269.  
  270.    TEST is an attribute test that selects the insns we are describing
  271. in this definition.  Note that an insn may use more than one function
  272. unit and a function unit may be specified in more than one
  273. `define_function_unit'.
  274.  
  275.    READY-DELAY is an integer that specifies the number of cycles after
  276. which the result of the instruction can be used without introducing any
  277. stalls.
  278.  
  279.    ISSUE-DELAY is an integer that specifies the number of cycles after
  280. the instruction matching the TEST expression begins using this unit
  281. until a subsequent instruction can begin.  A cost of N indicates an N-1
  282. cycle delay.  A subsequent instruction may also be delayed if an
  283. earlier instruction has a longer READY-DELAY value.  This blocking
  284. effect is computed using the SIMULTANEITY, READY-DELAY, ISSUE-DELAY,
  285. and CONFLICT-LIST terms.  For a normal non-pipelined function unit,
  286. SIMULTANEITY is one, the unit is taken to block for the READY-DELAY
  287. cycles of the executing insn, and smaller values of ISSUE-DELAY are
  288. ignored.
  289.  
  290.    CONFLICT-LIST is an optional list giving detailed conflict costs for
  291. this unit.  If specified, it is a list of condition test expressions to
  292. be applied to insns chosen to execute in NAME following the particular
  293. insn matching TEST that is already executing in NAME.  For each insn in
  294. the list, ISSUE-DELAY specifies the conflict cost; for insns not in the
  295. list, the cost is zero.  If not specified, CONFLICT-LIST defaults to
  296. all instructions that use the function unit.
  297.  
  298.    Typical uses of this vector are where a floating point function unit
  299. can pipeline either single- or double-precision operations, but not
  300. both, or where a memory unit can pipeline loads, but not stores, etc.
  301.  
  302.    As an example, consider a classic RISC machine where the result of a
  303. load instruction is not available for two cycles (a single "delay"
  304. instruction is required) and where only one load instruction can be
  305. executed simultaneously.  This would be specified as:
  306.  
  307.      (define_function_unit "memory" 1 1 (eq_attr "type" "load") 2 0)
  308.  
  309.    For the case of a floating point function unit that can pipeline
  310. either single or double precision, but not both, the following could be
  311. specified:
  312.  
  313.      (define_function_unit
  314.         "fp" 1 0 (eq_attr "type" "sp_fp") 4 4 [(eq_attr "type" "dp_fp")])
  315.      (define_function_unit
  316.         "fp" 1 0 (eq_attr "type" "dp_fp") 4 4 [(eq_attr "type" "sp_fp")])
  317.  
  318.    *Note:* The scheduler attempts to avoid function unit conflicts and
  319. uses all the specifications in the `define_function_unit' expression.
  320. It has recently come to our attention that these specifications may not
  321. allow modeling of some of the newer "superscalar" processors that have
  322. insns using multiple pipelined units.  These insns will cause a
  323. potential conflict for the second unit used during their execution and
  324. there is no way of representing that conflict.  We welcome any examples
  325. of how function unit conflicts work in such processors and suggestions
  326. for their representation.
  327.  
  328. 
  329. File: gcc.info,  Node: Target Macros,  Next: Config,  Prev: Machine Desc,  Up: Top
  330.  
  331. Target Description Macros
  332. *************************
  333.  
  334.    In addition to the file `MACHINE.md', a machine description includes
  335. a C header file conventionally given the name `MACHINE.h'.  This header
  336. file defines numerous macros that convey the information about the
  337. target machine that does not fit into the scheme of the `.md' file.
  338. The file `tm.h' should be a link to `MACHINE.h'.  The header file
  339. `config.h' includes `tm.h' and most compiler source files include
  340. `config.h'.
  341.  
  342. * Menu:
  343.  
  344. * Driver::              Controlling how the driver runs the compilation passes.
  345. * Run-time Target::     Defining `-m' options like `-m68000' and `-m68020'.
  346. * Storage Layout::      Defining sizes and alignments of data.
  347. * Type Layout::         Defining sizes and properties of basic user data types.
  348. * Registers::           Naming and describing the hardware registers.
  349. * Register Classes::    Defining the classes of hardware registers.
  350. * Stack and Calling::   Defining which way the stack grows and by how much.
  351. * Varargs::        Defining the varargs macros.
  352. * Trampolines::         Code set up at run time to enter a nested function.
  353. * Library Calls::       Controlling how library routines are implicitly called.
  354. * Addressing Modes::    Defining addressing modes valid for memory operands.
  355. * Condition Code::      Defining how insns update the condition code.
  356. * Costs::               Defining relative costs of different operations.
  357. * Sections::            Dividing storage into text, data, and other sections.
  358. * PIC::            Macros for position independent code.
  359. * Assembler Format::    Defining how to write insns and pseudo-ops to output.
  360. * Debugging Info::      Defining the format of debugging output.
  361. * Cross-compilation::   Handling floating point for cross-compilers.
  362. * Misc::                Everything else.
  363.  
  364. 
  365. File: gcc.info,  Node: Driver,  Next: Run-time Target,  Up: Target Macros
  366.  
  367. Controlling the Compilation Driver, `gcc'
  368. =========================================
  369.  
  370.    You can control the compilation driver.
  371.  
  372. `SWITCH_TAKES_ARG (CHAR)'
  373.      A C expression which determines whether the option `-CHAR' takes
  374.      arguments.  The value should be the number of arguments that
  375.      option takes-zero, for many options.
  376.  
  377.      By default, this macro is defined as `DEFAULT_SWITCH_TAKES_ARG',
  378.      which handles the standard options properly.  You need not define
  379.      `SWITCH_TAKES_ARG' unless you wish to add additional options which
  380.      take arguments.  Any redefinition should call
  381.      `DEFAULT_SWITCH_TAKES_ARG' and then check for additional options.
  382.  
  383. `WORD_SWITCH_TAKES_ARG (NAME)'
  384.      A C expression which determines whether the option `-NAME' takes
  385.      arguments.  The value should be the number of arguments that
  386.      option takes-zero, for many options.  This macro rather than
  387.      `SWITCH_TAKES_ARG' is used for multi-character option names.
  388.  
  389.      By default, this macro is defined as
  390.      `DEFAULT_WORD_SWITCH_TAKES_ARG', which handles the standard options
  391.      properly.  You need not define `WORD_SWITCH_TAKES_ARG' unless you
  392.      wish to add additional options which take arguments.  Any
  393.      redefinition should call `DEFAULT_WORD_SWITCH_TAKES_ARG' and then
  394.      check for additional options.
  395.  
  396. `SWITCH_CURTAILS_COMPILATION (CHAR)'
  397.      A C expression which determines whether the option `-CHAR' stops
  398.      compilation before the generation of an executable.  The value is
  399.      boolean, non-zero if the option does stop an executable from being
  400.      generated, zero otherwise.
  401.  
  402.      By default, this macro is defined as
  403.      `DEFAULT_SWITCH_CURTAILS_COMPILATION', which handles the standard
  404.      options properly.  You need not define
  405.      `SWITCH_CURTAILS_COMPILATION' unless you wish to add additional
  406.      options which affect the generation of an executable.  Any
  407.      redefinition should call `DEFAULT_SWITCH_CURTAILS_COMPILATION' and
  408.      then check for additional options.
  409.  
  410. `SWITCHES_NEED_SPACES'
  411.      A string-valued C expression which enumerates the options for which
  412.      the linker needs a space between the option and its argument.
  413.  
  414.      If this macro is not defined, the default value is `""'.
  415.  
  416. `CPP_SPEC'
  417.      A C string constant that tells the GNU CC driver program options to
  418.      pass to CPP.  It can also specify how to translate options you
  419.      give to GNU CC into options for GNU CC to pass to the CPP.
  420.  
  421.      Do not define this macro if it does not need to do anything.
  422.  
  423. `NO_BUILTIN_SIZE_TYPE'
  424.      If this macro is defined, the preprocessor will not define the
  425.      builtin macro `__SIZE_TYPE__'.  The macro `__SIZE_TYPE__' must
  426.      then be defined by `CPP_SPEC' instead.
  427.  
  428.      This should be defined if `SIZE_TYPE' depends on target dependent
  429.      flags which are not accessible to the preprocessor.  Otherwise, it
  430.      should not be defined.
  431.  
  432. `NO_BUILTIN_PTRDIFF_TYPE'
  433.      If this macro is defined, the preprocessor will not define the
  434.      builtin macro `__PTRDIFF_TYPE__'.  The macro `__PTRDIFF_TYPE__'
  435.      must then be defined by `CPP_SPEC' instead.
  436.  
  437.      This should be defined if `PTRDIFF_TYPE' depends on target
  438.      dependent flags which are not accessible to the preprocessor.
  439.      Otherwise, it should not be defined.
  440.  
  441. `SIGNED_CHAR_SPEC'
  442.      A C string constant that tells the GNU CC driver program options to
  443.      pass to CPP.  By default, this macro is defined to pass the option
  444.      `-D__CHAR_UNSIGNED__' to CPP if `char' will be treated as
  445.      `unsigned char' by `cc1'.
  446.  
  447.      Do not define this macro unless you need to override the default
  448.      definition.
  449.  
  450. `CC1_SPEC'
  451.      A C string constant that tells the GNU CC driver program options to
  452.      pass to `cc1'.  It can also specify how to translate options you
  453.      give to GNU CC into options for GNU CC to pass to the `cc1'.
  454.  
  455.      Do not define this macro if it does not need to do anything.
  456.  
  457. `CC1PLUS_SPEC'
  458.      A C string constant that tells the GNU CC driver program options to
  459.      pass to `cc1plus'.  It can also specify how to translate options
  460.      you give to GNU CC into options for GNU CC to pass to the
  461.      `cc1plus'.
  462.  
  463.      Do not define this macro if it does not need to do anything.
  464.  
  465. `ASM_SPEC'
  466.      A C string constant that tells the GNU CC driver program options to
  467.      pass to the assembler.  It can also specify how to translate
  468.      options you give to GNU CC into options for GNU CC to pass to the
  469.      assembler.  See the file `sun3.h' for an example of this.
  470.  
  471.      Do not define this macro if it does not need to do anything.
  472.  
  473. `ASM_FINAL_SPEC'
  474.      A C string constant that tells the GNU CC driver program how to
  475.      run any programs which cleanup after the normal assembler.
  476.      Normally, this is not needed.  See the file `mips.h' for an
  477.      example of this.
  478.  
  479.      Do not define this macro if it does not need to do anything.
  480.  
  481. `LINK_SPEC'
  482.      A C string constant that tells the GNU CC driver program options to
  483.      pass to the linker.  It can also specify how to translate options
  484.      you give to GNU CC into options for GNU CC to pass to the linker.
  485.  
  486.      Do not define this macro if it does not need to do anything.
  487.  
  488. `LIB_SPEC'
  489.      Another C string constant used much like `LINK_SPEC'.  The
  490.      difference between the two is that `LIB_SPEC' is used at the end
  491.      of the command given to the linker.
  492.  
  493.      If this macro is not defined, a default is provided that loads the
  494.      standard C library from the usual place.  See `gcc.c'.
  495.  
  496. `LIBGCC_SPEC'
  497.      Another C string constant that tells the GNU CC driver program how
  498.      and when to place a reference to `libgcc.a' into the linker
  499.      command line.  This constant is placed both before and after the
  500.      value of `LIB_SPEC'.
  501.  
  502.      If this macro is not defined, the GNU CC driver provides a default
  503.      that passes the string `-lgcc' to the linker unless the `-shared'
  504.      option is specified.
  505.  
  506. `STARTFILE_SPEC'
  507.      Another C string constant used much like `LINK_SPEC'.  The
  508.      difference between the two is that `STARTFILE_SPEC' is used at the
  509.      very beginning of the command given to the linker.
  510.  
  511.      If this macro is not defined, a default is provided that loads the
  512.      standard C startup file from the usual place.  See `gcc.c'.
  513.  
  514. `ENDFILE_SPEC'
  515.      Another C string constant used much like `LINK_SPEC'.  The
  516.      difference between the two is that `ENDFILE_SPEC' is used at the
  517.      very end of the command given to the linker.
  518.  
  519.      Do not define this macro if it does not need to do anything.
  520.  
  521. `EXTRA_SPECS'
  522.      Define this macro to provide additional specifications to put in
  523.      the `specs' file that can be used in various specifications like
  524.      `CC1_SPEC'.
  525.  
  526.      The definition should be an initializer for an array of structures,
  527.      containing a string constant, that defines the specification name,
  528.      and a string constant that provides the specification.
  529.  
  530.      Do not define this macro if it does not need to do anything.
  531.  
  532.      `EXTRA_SPECS' is useful when an architecture contains several
  533.      related targets, which have various `..._SPECS' which are similar
  534.      to each other, and the maintainer would like one central place to
  535.      keep these definitions.
  536.  
  537.      For example, the PowerPC System V.4 targets use `EXTRA_SPECS' to
  538.      define either `_CALL_SYSV' when the System V calling sequence is
  539.      used or `_CALL_AIX' when the older AIX-based calling sequence is
  540.      used.
  541.  
  542.      The `config/rs6000/rs6000.h' target file defines:
  543.  
  544.           #define EXTRA_SPECS \
  545.             { "cpp_sysv_default", CPP_SYSV_DEFAULT },
  546.           
  547.           #define CPP_SYS_DEFAULT ""
  548.  
  549.      The `config/rs6000/sysv.h' target file defines:
  550.           #undef CPP_SPEC
  551.           #define CPP_SPEC \
  552.           "%{posix: -D_POSIX_SOURCE } \
  553.           %{mcall-sysv: -D_CALL_SYSV } %{mcall-aix: -D_CALL_AIX } \
  554.           %{!mcall-sysv: %{!mcall-aix: %(cpp_sysv_default) }} \
  555.           %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
  556.           
  557.           #undef CPP_SYSV_DEFAULT
  558.           #define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
  559.  
  560.      while the `config/rs6000/eabiaix.h' target file defines
  561.      `CPP_SYSV_DEFAULT' as:
  562.  
  563.           #undef CPP_SYSV_DEFAULT
  564.           #define CPP_SYSV_DEFAULT "-D_CALL_AIX"
  565.  
  566. `LINK_LIBGCC_SPECIAL'
  567.      Define this macro if the driver program should find the library
  568.      `libgcc.a' itself and should not pass `-L' options to the linker.
  569.      If you do not define this macro, the driver program will pass the
  570.      argument `-lgcc' to tell the linker to do the search and will pass
  571.      `-L' options to it.
  572.  
  573. `LINK_LIBGCC_SPECIAL_1'
  574.      Define this macro if the driver program should find the library
  575.      `libgcc.a'.  If you do not define this macro, the driver program
  576.      will pass the argument `-lgcc' to tell the linker to do the search.
  577.      This macro is similar to `LINK_LIBGCC_SPECIAL', except that it does
  578.      not affect `-L' options.
  579.  
  580. `LINK_COMMAND_SPEC'
  581.      A C string constant giving the complete command line need to
  582.      execute the linker.  When you do this, you will need to update
  583.      your port each time a change is made to the link command line
  584.      within `gcc.c'.  Therefore, define this macro only if you need to
  585.      completely redefine the command line for invoking the linker and
  586.      there is no other way to accomplish the effect you need.
  587.  
  588. `MULTILIB_DEFAULTS'
  589.      Define this macro as a C expression for the initializer of an
  590.      array of string to tell the driver program which options are
  591.      defaults for this target and thus do not need to be handled
  592.      specially when using `MULTILIB_OPTIONS'.
  593.  
  594.      Do not define this macro if `MULTILIB_OPTIONS' is not defined in
  595.      the target makefile fragment or if none of the options listed in
  596.      `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.
  597.  
  598. `RELATIVE_PREFIX_NOT_LINKDIR'
  599.      Define this macro to tell `gcc' that it should only translate a
  600.      `-B' prefix into a `-L' linker option if the prefix indicates an
  601.      absolute file name.
  602.  
  603. `STANDARD_EXEC_PREFIX'
  604.      Define this macro as a C string constant if you wish to override
  605.      the standard choice of `/usr/local/lib/gcc-lib/' as the default
  606.      prefix to try when searching for the executable files of the
  607.      compiler.
  608.  
  609. `MD_EXEC_PREFIX'
  610.      If defined, this macro is an additional prefix to try after
  611.      `STANDARD_EXEC_PREFIX'.  `MD_EXEC_PREFIX' is not searched when the
  612.      `-b' option is used, or the compiler is built as a cross compiler.
  613.      If you define `MD_EXEC_PREFIX', then be sure to add it to the
  614.      list of directories used to find the assembler in `configure.in'.
  615.  
  616. `STANDARD_STARTFILE_PREFIX'
  617.      Define this macro as a C string constant if you wish to override
  618.      the standard choice of `/usr/local/lib/' as the default prefix to
  619.      try when searching for startup files such as `crt0.o'.
  620.  
  621. `MD_STARTFILE_PREFIX'
  622.      If defined, this macro supplies an additional prefix to try after
  623.      the standard prefixes.  `MD_EXEC_PREFIX' is not searched when the
  624.      `-b' option is used, or when the compiler is built as a cross
  625.      compiler.
  626.  
  627. `MD_STARTFILE_PREFIX_1'
  628.      If defined, this macro supplies yet another prefix to try after the
  629.      standard prefixes.  It is not searched when the `-b' option is
  630.      used, or when the compiler is built as a cross compiler.
  631.  
  632. `INIT_ENVIRONMENT'
  633.      Define this macro as a C string constant if you wish to set
  634.      environment variables for programs called by the driver, such as
  635.      the assembler and loader.  The driver passes the value of this
  636.      macro to `putenv' to initialize the necessary environment
  637.      variables.
  638.  
  639. `LOCAL_INCLUDE_DIR'
  640.      Define this macro as a C string constant if you wish to override
  641.      the standard choice of `/usr/local/include' as the default prefix
  642.      to try when searching for local header files.  `LOCAL_INCLUDE_DIR'
  643.      comes before `SYSTEM_INCLUDE_DIR' in the search order.
  644.  
  645.      Cross compilers do not use this macro and do not search either
  646.      `/usr/local/include' or its replacement.
  647.  
  648. `SYSTEM_INCLUDE_DIR'
  649.      Define this macro as a C string constant if you wish to specify a
  650.      system-specific directory to search for header files before the
  651.      standard directory.  `SYSTEM_INCLUDE_DIR' comes before
  652.      `STANDARD_INCLUDE_DIR' in the search order.
  653.  
  654.      Cross compilers do not use this macro and do not search the
  655.      directory specified.
  656.  
  657. `STANDARD_INCLUDE_DIR'
  658.      Define this macro as a C string constant if you wish to override
  659.      the standard choice of `/usr/include' as the default prefix to try
  660.      when searching for header files.
  661.  
  662.      Cross compilers do not use this macro and do not search either
  663.      `/usr/include' or its replacement.
  664.  
  665. `STANDARD_INCLUDE_COMPONENT'
  666.      The "component" corresponding to `STANDARD_INCLUDE_DIR'.  See
  667.      `INCLUDE_DEFAULTS', below, for the description of components.  If
  668.      you do not define this macro, no component is used.
  669.  
  670. `INCLUDE_DEFAULTS'
  671.      Define this macro if you wish to override the entire default
  672.      search path for include files.  For a native compiler, the default
  673.      search path usually consists of `GCC_INCLUDE_DIR',
  674.      `LOCAL_INCLUDE_DIR', `SYSTEM_INCLUDE_DIR',
  675.      `GPLUSPLUS_INCLUDE_DIR', and `STANDARD_INCLUDE_DIR'.  In addition,
  676.      `GPLUSPLUS_INCLUDE_DIR' and `GCC_INCLUDE_DIR' are defined
  677.      automatically by `Makefile', and specify private search areas for
  678.      GCC.  The directory `GPLUSPLUS_INCLUDE_DIR' is used only for C++
  679.      programs.
  680.  
  681.      The definition should be an initializer for an array of structures.
  682.      Each array element should have four elements: the directory name (a
  683.      string constant), the component name, and flag for C++-only
  684.      directories, and a flag showing that the includes in the directory
  685.      don't need to be wrapped in `extern `C'' when compiling C++.  Mark
  686.      the end of the array with a null element.
  687.  
  688.      The component name denotes what GNU package the include file is
  689.      part of, if any, in all upper-case letters.  For example, it might
  690.      be `GCC' or `BINUTILS'.  If the package is part of the a
  691.      vendor-supplied operating system, code the component name as `0'.
  692.  
  693.      For example, here is the definition used for VAX/VMS:
  694.  
  695.           #define INCLUDE_DEFAULTS \
  696.           {                                       \
  697.             { "GNU_GXX_INCLUDE:", "G++", 1, 1},   \
  698.             { "GNU_CC_INCLUDE:", "GCC", 0, 0},    \
  699.             { "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0},  \
  700.             { ".", 0, 0, 0},                      \
  701.             { 0, 0, 0, 0}                         \
  702.           }
  703.  
  704.    Here is the order of prefixes tried for exec files:
  705.  
  706.   1. Any prefixes specified by the user with `-B'.
  707.  
  708.   2. The environment variable `GCC_EXEC_PREFIX', if any.
  709.  
  710.   3. The directories specified by the environment variable
  711.      `COMPILER_PATH'.
  712.  
  713.   4. The macro `STANDARD_EXEC_PREFIX'.
  714.  
  715.   5. `/usr/lib/gcc/'.
  716.  
  717.   6. The macro `MD_EXEC_PREFIX', if any.
  718.  
  719.    Here is the order of prefixes tried for startfiles:
  720.  
  721.   1. Any prefixes specified by the user with `-B'.
  722.  
  723.   2. The environment variable `GCC_EXEC_PREFIX', if any.
  724.  
  725.   3. The directories specified by the environment variable
  726.      `LIBRARY_PATH' (native only, cross compilers do not use this).
  727.  
  728.   4. The macro `STANDARD_EXEC_PREFIX'.
  729.  
  730.   5. `/usr/lib/gcc/'.
  731.  
  732.   6. The macro `MD_EXEC_PREFIX', if any.
  733.  
  734.   7. The macro `MD_STARTFILE_PREFIX', if any.
  735.  
  736.   8. The macro `STANDARD_STARTFILE_PREFIX'.
  737.  
  738.   9. `/lib/'.
  739.  
  740.  10. `/usr/lib/'.
  741.  
  742. 
  743. File: gcc.info,  Node: Run-time Target,  Next: Storage Layout,  Prev: Driver,  Up: Target Macros
  744.  
  745. Run-time Target Specification
  746. =============================
  747.  
  748.    Here are run-time target specifications.
  749.  
  750. `CPP_PREDEFINES'
  751.      Define this to be a string constant containing `-D' options to
  752.      define the predefined macros that identify this machine and system.
  753.      These macros will be predefined unless the `-ansi' option is
  754.      specified.
  755.  
  756.      In addition, a parallel set of macros are predefined, whose names
  757.      are made by appending `__' at the beginning and at the end.  These
  758.      `__' macros are permitted by the ANSI standard, so they are
  759.      predefined regardless of whether `-ansi' is specified.
  760.  
  761.      For example, on the Sun, one can use the following value:
  762.  
  763.           "-Dmc68000 -Dsun -Dunix"
  764.  
  765.      The result is to define the macros `__mc68000__', `__sun__' and
  766.      `__unix__' unconditionally, and the macros `mc68000', `sun' and
  767.      `unix' provided `-ansi' is not specified.
  768.  
  769. `extern int target_flags;'
  770.      This declaration should be present.
  771.  
  772. `TARGET_...'
  773.      This series of macros is to allow compiler command arguments to
  774.      enable or disable the use of optional features of the target
  775.      machine.  For example, one machine description serves both the
  776.      68000 and the 68020; a command argument tells the compiler whether
  777.      it should use 68020-only instructions or not.  This command
  778.      argument works by means of a macro `TARGET_68020' that tests a bit
  779.      in `target_flags'.
  780.  
  781.      Define a macro `TARGET_FEATURENAME' for each such option.  Its
  782.      definition should test a bit in `target_flags'; for example:
  783.  
  784.           #define TARGET_68020 (target_flags & 1)
  785.  
  786.      One place where these macros are used is in the
  787.      condition-expressions of instruction patterns.  Note how
  788.      `TARGET_68020' appears frequently in the 68000 machine description
  789.      file, `m68k.md'.  Another place they are used is in the
  790.      definitions of the other macros in the `MACHINE.h' file.
  791.  
  792. `TARGET_SWITCHES'
  793.      This macro defines names of command options to set and clear bits
  794.      in `target_flags'.  Its definition is an initializer with a
  795.      subgrouping for each command option.
  796.  
  797.      Each subgrouping contains a string constant, that defines the
  798.      option name, a number, which contains the bits to set in
  799.      `target_flags', and a second string which is the description
  800.      displayed by -help.  If the number is negative then the bits
  801.      specified by the number are cleared instead of being set.  If the
  802.      description string is present but empty, then no help information
  803.      will be displayed for that option, but it will not count as an
  804.      undocumented option.  The actual option name is made by appending
  805.      `-m' to the specified name.
  806.  
  807.      One of the subgroupings should have a null string.  The number in
  808.      this grouping is the default value for `target_flags'.  Any target
  809.      options act starting with that value.
  810.  
  811.      Here is an example which defines `-m68000' and `-m68020' with
  812.      opposite meanings, and picks the latter as the default:
  813.  
  814.           #define TARGET_SWITCHES \
  815.             { { "68020", 1, "" },      \
  816.               { "68000", -1, "Compile for the 68000" }, \
  817.               { "", 1, "" }}
  818.  
  819. `TARGET_OPTIONS'
  820.      This macro is similar to `TARGET_SWITCHES' but defines names of
  821.      command options that have values.  Its definition is an
  822.      initializer with a subgrouping for each command option.
  823.  
  824.      Each subgrouping contains a string constant, that defines the
  825.      fixed part of the option name, the address of a variable, and a
  826.      description string.  The variable, type `char *', is set to the
  827.      variable part of the given option if the fixed part matches.  The
  828.      actual option name is made by appending `-m' to the specified name.
  829.  
  830.      Here is an example which defines `-mshort-data-NUMBER'.  If the
  831.      given option is `-mshort-data-512', the variable `m88k_short_data'
  832.      will be set to the string `"512"'.
  833.  
  834.           extern char *m88k_short_data;
  835.           #define TARGET_OPTIONS \
  836.            { { "short-data-", &m88k_short_data, "Specify the size of the short data section" } }
  837.  
  838. `TARGET_VERSION'
  839.      This macro is a C statement to print on `stderr' a string
  840.      describing the particular machine description choice.  Every
  841.      machine description should define `TARGET_VERSION'.  For example:
  842.  
  843.           #ifdef MOTOROLA
  844.           #define TARGET_VERSION \
  845.             fprintf (stderr, " (68k, Motorola syntax)");
  846.           #else
  847.           #define TARGET_VERSION \
  848.             fprintf (stderr, " (68k, MIT syntax)");
  849.           #endif
  850.  
  851. `OVERRIDE_OPTIONS'
  852.      Sometimes certain combinations of command options do not make
  853.      sense on a particular target machine.  You can define a macro
  854.      `OVERRIDE_OPTIONS' to take account of this.  This macro, if
  855.      defined, is executed once just after all the command options have
  856.      been parsed.
  857.  
  858.      Don't use this macro to turn on various extra optimizations for
  859.      `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.
  860.  
  861. `OPTIMIZATION_OPTIONS (LEVEL, SIZE)'
  862.      Some machines may desire to change what optimizations are
  863.      performed for various optimization levels.   This macro, if
  864.      defined, is executed once just after the optimization level is
  865.      determined and before the remainder of the command options have
  866.      been parsed.  Values set in this macro are used as the default
  867.      values for the other command line options.
  868.  
  869.      LEVEL is the optimization level specified; 2 if `-O2' is
  870.      specified, 1 if `-O' is specified, and 0 if neither is specified.
  871.  
  872.      SIZE is non-zero if `-Os' is specified and zero otherwise.
  873.  
  874.      You should not use this macro to change options that are not
  875.      machine-specific.  These should uniformly selected by the same
  876.      optimization level on all supported machines.  Use this macro to
  877.      enable machine-specific optimizations.
  878.  
  879.      *Do not examine `write_symbols' in this macro!* The debugging
  880.      options are not supposed to alter the generated code.
  881.  
  882. `CAN_DEBUG_WITHOUT_FP'
  883.      Define this macro if debugging can be performed even without a
  884.      frame pointer.  If this macro is defined, GNU CC will turn on the
  885.      `-fomit-frame-pointer' option whenever `-O' is specified.
  886.  
  887.